﻿<!DOCTYPE html>
<html lang=en>

<head>
    <meta charset=utf-8>
    <meta http-equiv=X-UA-Compatible content="IE=edge">
    <meta name=viewport content="maximum-scale=1,minimum-scale=1,user-scalable=no,width=device-width,initial-scale=1">
    <meta name=renderer content=webkit>
    <meta name=format-detection content="telephone=yes">
    <title>学习学习</title>
    <style type="text/css">
        video {
            width: 100%;
        }
    </style>
</head>

<body>
    <script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
    <script type="text/javascript">
        function gethls() {
            var hash = location.hash;
            if (hash) {
                var matchs = /#(\d+)-(\d+)/.exec(hash);
                if (matchs && matchs.length == 3) {
                    return 'https://cdn.jsdelivr.net/gh/cdndb/cto-' + matchs[1] + '@tsfiles/' + matchs[2] +
                        '/index.m3u8'
                }
                else{
                    return hash.substr(1);
                }
            }

            return '';
        }

        function gethls2() {
            var hash = location.hash;
            if (hash) {
                var matchs = /#(\d+)-(\d+)/.exec(hash);
                if (matchs && matchs.length == 3) {
                    //https://api-cto.go8.workers.dev/ge/raw/10200/174120/index.m3u8
                    return 'https://api-cto.go8.workers.dev/ge/raw/' + matchs[1] + '/' + matchs[2] + '/index.m3u8'
                }
                else{
                    return hash.substr(1);
                }
            }

            return '';
        }

        window.addEventListener("hashchange", function (e) {
            location.reload(true);
        });
    </script>

    <video id="video" controls="controls"></video>
    <script>
        var video = document.getElementById('video');
        if (Hls.isSupported()) {
            var hls = new Hls();

            hls.loadSource(gethls());
            hls.attachMedia(video);
            hls.on(Hls.Events.MANIFEST_PARSED, function () {
                video.play();
            });


        }
        // hls.js is not supported on platforms that do not have Media Source Extensions (MSE) enabled.
        // When the browser has built-in HLS support (check using `canPlayType`), we can provide an HLS manifest (i.e. .m3u8 URL) directly to the video element throught the `src` property.
        // This is using the built-in support of the plain video element, without using hls.js.
        // Note: it would be more normal to wait on the 'canplay' event below however on Safari (where you are most likely to find built-in HLS support) the video.src URL must be on the user-driven
        // white-list before a 'canplay' event will be emitted; the last video event that can be reliably listened-for when the URL is not on the white-list is 'loadedmetadata'.
        else if (video.canPlayType('application/vnd.apple.mpegurl')) {
            video.src = gethls();
            video.addEventListener('loadedmetadata', function () {
                video.play();
            });


        }
    </script>
        <div>
            <script type="text/javascript" src="//js.users.51.la/20688837.js"></script>
        </div>
</body>


</html>